package com.viaje.action.ranking;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

import com.viaje.model.Ranking;
import com.viaje.common.util.Utilitario;
import java.util.List;

@Action(value="/list-ranking",
results={@Result(name="exito", type="tiles",
location="list-ranking.tiles")
} )
public class ListRankingAction {
private List<Ranking> ranking;
	
	public String execute(){
		String result="exito";
		EntityManager em= Utilitario.getInstance().getEntityManager();
		Query query=em.createQuery("Select o From Ranking o");
		ranking=query.getResultList();
		return result;
	}

	public List<Ranking> getRanking() {
		return ranking;
	}

	public void setRanking(List<Ranking> ranking) {
		this.ranking = ranking;
	}


	
	
}